package com.hntest.service;

import com.hntest.entity.Bid;
import com.hntest.entity.BidRequest;
import com.hntest.entity.Logininfo;
import com.hntest.entity.Pager;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import static org.junit.Assert.*;
@RunWith(SpringRunner.class)
@SpringBootTest
public class BidServiceTest {
    @Autowired
    private BidService bidService;

    @Test
    public void insert() {
        Logininfo log = new Logininfo();
        log.setLid(233);
        log.setPassword("123123");
        Bid b = new Bid(99, BigDecimal.valueOf(0.13),BigDecimal.valueOf(1000),BigDecimal.valueOf(1000),1,log,new Date(),"好穷啊啊啊",new BidRequest(),new Logininfo());
        System.out.println(bidService.insert(b));
    }
    @Test
    public void getCounts() {

    }

    @Test
    public void getListByPage() {
        Pager p = new Pager();
        p.setCurrPage(1);
        p.setPageSize(3);
        Bid bid = new Bid();
        List<Bid> list = bidService.getListByPage(p,bid);
        System.out.println(list.size()+"tiao");
        for (Bid b : list) {
            System.out.println(b);
        }
    }

    @Test
    public void update() {
    }
}